home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-04-21 | 3.5 KB | 119 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWPoint.h
- // Release Version: $ 1.0d1 $
- //
- // Creation Date: 3/28/94
- //
- // Copyright: © 1993, 1994 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWPOINT_H
- #define FWPOINT_H
-
- #ifndef FWGRDEF_H
- #include "FWGrDef.h"
- #endif
-
- // ----- Fundation Includes -----
-
- #ifndef FWSTDDEF_H
- #include "FWStdDef.h"
- #endif
-
- // ----- OpenDoc Includes -----
-
- #ifndef _PLFMTYPE_
- #include "PlfmType.h"
- #endif
-
-
- //========================================================================================
- // •• Forward Declarations
- //========================================================================================
-
- struct FW_CRect;
- class FW_CWritableStream;
- class FW_CReadableStream;
-
- //========================================================================================
- // •• Typedefs
- //========================================================================================
-
- typedef unsigned short FW_XYSelector;
-
- const FW_XYSelector FW_kHorizontal = 0;
- const FW_XYSelector FW_kVertical = 1;
-
- //========================================================================================
- // •• struct FW_CPoint
- //========================================================================================
-
- struct FW_CPoint : public XMPPoint
- {
- public:
- FW_CPoint() {x = y = 0;}
- FW_CPoint(XMPCoordinate xx, XMPCoordinate yy)
- {x=xx; y=yy;}
- FW_CPoint(const FW_CPoint& point);
- FW_CPoint(const XMPPoint& xmpPoint);
- FW_CPoint(FW_SPlatformPoint plfmPoint);
-
- // ----- Assignement -----
- FW_CPoint& operator=(const FW_CPoint& point);
- FW_CPoint& operator=(const XMPPoint& xmpPoint);
- FW_CPoint& operator=(FW_SPlatformPoint plfmPoint);
-
- // ----- Conversion -----
- void AsPlatformPoint(FW_SPlatformPoint& plfmPoint) const;
- operator FW_SPlatformPoint() const;
-
- // ----- Modification -----
- inline void Clear()
- {x=y=0;}
- inline void Set(XMPCoordinate xx, XMPCoordinate yy)
- {x=xx; y=yy;}
- void Offset(XMPCoordinate xx, XMPCoordinate yy);
- void Map(const FW_CRect& srcRect, const FW_CRect& destRect);
-
- FW_CPoint& operator+=(const FW_CPoint& point);
- FW_CPoint& operator-=(const FW_CPoint& point);
- FW_CPoint& operator+=(const XMPPoint& xmPoint);
- FW_CPoint& operator-=(const XMPPoint& xmPoint);
-
- FW_CPoint operator+(const FW_CPoint& point) const;
- FW_CPoint operator-(const FW_CPoint& point) const;
- FW_CPoint operator+(const XMPPoint& xmPoint) const;
- FW_CPoint operator-(const XMPPoint& xmPoint) const;
- FW_CPoint operator-() const;
-
- FW_CPoint& operator+=(FW_SPlatformPoint plfmPoint);
- FW_CPoint& operator-=(FW_SPlatformPoint plfmPoint);
- FW_CPoint operator+(FW_SPlatformPoint plfmPoint) const;
- FW_CPoint operator-(FW_SPlatformPoint plfmPoint) const;
-
- // ----- Accessors -----
- short IntX() const;
- short IntY() const;
-
- XMPCoordinate& operator[](FW_XYSelector selector);
- XMPCoordinate operator[](FW_XYSelector selector) const;
-
- // ----- Comparison -----
- FW_Boolean operator==(const FW_CPoint& point) const;
- FW_Boolean operator!=(const FW_CPoint& point) const;
- FW_Boolean operator==(const XMPPoint& xmPoint) const;
- FW_Boolean operator!=(const XMPPoint& xmPoint) const;
-
- // ----- Stream -----
- void Flatten(FW_CWritableStream& stream);
- void Unflatten(FW_CReadableStream& stream);
-
- // ----- Utilities -----
- static FW_XYSelector FW_CPoint::GetOrthogonal(FW_XYSelector selector)
- {return (selector + 1) & 1;}
- };
-
- #endif
-